#ifndef LOGGER_H
#define LOGGER_H

#include <QObject>
#include <QString>
#include <QFile>

#define LOG Logger::instance()->add

/* ---------------------------
  | Class for logging to file.
  |     Singleton.
    -------------------------- */

class Logger{
public:
    static QString logFileName;
    static Logger *instance();
    static void CreateInstance();
    static void DestroyInstance();

    // main function for adding log-entry
    void add(const QString who,
             const QString what,
             const QString comment = QString(""));

private:
    Logger();
    ~Logger();
    static Logger *mInstance;

    QFile logFile;

    // function fomats log-entry
    QString formatLog(const QString who, const QString what, const QString comment) const;
};
#endif // LOGGER_H
